#ifndef SETTINGSIMPORT_HPP
#define SETTINGSIMPORT_HPP

#include "settings.hpp"
#include "simulationTime.hpp"

#include <filesystem>

namespace hms
{
namespace fs = std::filesystem;

ini::INIReader getReader( const fs::path& iniPath );

fs::path iniPath( const fs::path& caseDir );
void setReader( Settings& s );

/*************************************************************/

log::Settings getLogSettings(const ini::INIReader&, const fs::path& caseDir);
log::Settings getLogSettings( const hms::Settings& );

/*************************************************************/

bool getPrintLogoFlag( const ini::INIReader& );

/*************************************************************/

bool getBenchmarkFlag( const ini::INIReader& );

BenchmarkSettings getBenchmarkSettings( const ini::INIReader& );

MeshGenSettings getMeshGenSettings( const ini::INIReader& );

void setBenchmarkSettings( Settings& );

/*************************************************************/

std::string getCaseName(
	const ini::INIReader&, const fs::path& caseDir,
	bool runBenchmark, const BenchmarkSettings&
);
void setCaseName( Settings& );

/*************************************************************/

Time getTimeSettings( const ini::INIReader& );
void setTimeSettings( Settings& );

/*************************************************************/

WhichSolver whichSolver( const ini::INIReader& );

template<typename SolverType>
void readSolverSettings(
	const ini::INIReader& settings,
	SolverSettings<SolverType>& s,
	const std::string& derivedSection,
	bool integratedBlockLoop
);

SWESettings getSWESettings( const ini::INIReader& );
void setSWESettings( Settings& );

/*************************************************************/

std::vector<ProbeSettings> getProbeSettings( const ini::INIReader& );

void setProbeSettings( Settings& );

/*************************************************************/

bool getResumeSimFlag( const ini::INIReader& );

fs::path getBindingFilePath( Settings& );

void setStartTime( Settings& );

/*************************************************************/

ImportSettings getImportSettings( const ini::INIReader&, const fs::path& caseDir );
void setImportSettings( Settings& );

ExportSettings getExportSettings( const ini::INIReader& );
void setExportSettings( Settings& );

/*************************************************************/

template<typename E>
void readEnumOrDefault(
	const ini::INIReader&,
	const std::string& section,
	const std::string& item,
	E& defaultVal
);

template<typename E>
E readEnumOrDefault(
	const ini::INIReader&,
	const std::string& section,
	const std::string& item
);

void readIni( Settings& );

} // namespace hms

#include "settingsImport.tpp"

#endif